package com.endava.PropagatingAndCatchingAnException;

public class Propagate {

	public static void main(String[] args) {
		Propagate p=new Propagate();
		p.reverse("");
	}

	public String reverse(String s) {
		if (s.length() == 0) {
			throw new NullPointerException();
		} else {
			String reverseStr = "";
			for (int i = s.length() - 1; i >= 0; --i) {
				reverseStr += s.charAt(i);
			
			}
			System.out.println(reverseStr);
			return reverseStr;
		}
	}
}
